package com.linkelee.server.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.linkelee.api.result.JsonResult;
import com.linkelee.api.service.IRpcMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * 消息服务实现类
 * @author lsl
 * @since 2019-04-11
 */
@Component
@Service(version = "1.0.0")
public class RpcMessageServiceImpl implements IRpcMessageService {

    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 将消息状态更新为预发起
     * @param messageKey
     * @param messageData
     * @return
     */
    public JsonResult MessageToPreparing(String messageKey, Object messageData) {
        redisTemplate.opsForValue().set(messageKey,messageData);
        System.out.println("messageKey:"+messageKey+"-------"+"messageData:"+messageData);
        return null;
    }

    /**
     * 将消息状态更新为准备完毕
     * @param messageKey
     * @return
     */
    public JsonResult MessageToReady(String messageKey) {
        return null;
    }

    /**
     * 将消息状态更新为发送中
     * @param messageKey
     * @return
     */
    public JsonResult MessageToSending(String messageKey) {
        return null;
    }

    /**
     * 将消息状态更新为发送失败
     * @param messageKey
     * @return
     */
    public JsonResult MessageToSendingFail(String messageKey) {
        return null;
    }

    /**
     * 将消息状态更新为接收成功
     * @param messageKey
     * @return
     */
    public JsonResult MessageToReceiveSuccess(String messageKey) {
        return null;
    }

    /**
     * 将消息状态更新为接收失败
     * @param messageKey
     * @return
     */
    public JsonResult MessageToReceiveFail(String messageKey) {
        return null;
    }
}
